package com.axway.passport.am.ui.${package}.actions
{
	<#if targetClass!="Object" >import com.axway.passport.am.model.${targetClass}</#if>
	import com.axway.passport.am.ui.base.Action;
	import com.axway.passport.am.util.ArrayUtils;
	
	/**
	 *
	 * @author ccpascu
	 */
	[Bindable]
	public class ${actionName} extends Action
	{
		//[Embed(source="/assets/images/${actionName}.png")]
		private var ${actionName}Icon : Class;
		
		/**
		 * Action contructor. Perform initialization here.
		 */
		public function ${actionName}()
		{
			this.name = i18n.message("${package}.action.name.${actionName}");
			this.description = i18n.message("${package}.action.description.${actionName}");
			this.location = Action.DISPLAY_TOOLBAR;
			this.icon = ${actionName}Icon;
		}
		
		
		/**
		 *
		 */
		protected final override function onTargetChange() : void
		{
			var shouldEnable : Boolean = false;
			// Change properties of this action base on the new target.
			if (target == null) {
				// shouldEnable?
			} else if (target.length == 1 && target[0] is ${targetClass}) {
				var item : ${targetClass} = ${targetClass}(target[0]);
				if (item) {
					// Check a property here.
					shouldEnable = true;
				} 
			} else if (target.length > 0 && ArrayUtils.itemsAreOfType(target, ${targetClass})) {
				// Check all items have a property set?
			}
			this.enabled = shouldEnable;
		}
		
		
		/**
		 *
		 */
		protected final override function doExecute(event:Event) : void
		{
			super.doExecute(event);
		}
	
	}
}